<?php
/**
 * Created by PhpStorm.
 * User: Dick
 * Date: 2016/4/17
 * Time: 19:04
 */

namespace Controller;
use Model\Follow;

class Followsetting
{
    public function follow()
    {
        $following = $_SESSION['user']->id;
        $followed = $_SESSION['user']->towho;
        if (Follow::Getfollowing($following, $followed) != 0) {
            Follow::delfollow($following, $followed);
            echo 1;
            return;
        } else {
            Follow::addfollow($following, $followed);
            echo 0;
            return;
        }
    }


    public function getuserfollow()
    {
        $following = $_SESSION['user']->id;
        $followed = $_SESSION['user']->towho;
        Follow::GetFollow($following, $followed);
    }
}